﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Resources;
using System.Xml.Serialization;
using System.IO;

namespace EasyMp3Organizer
{
	/// <summary>
	/// Interaction logic for SettingsMenu.xaml
	/// </summary>
	public partial class SettingsMenu : UserControl
	{
		public SettingsMenu()
		{
			InitializeComponent();
		}

		private void OptionsReorder_Click(object sender, RoutedEventArgs e)
		{
			ListBox lst;
			if (sender == this.btnDirUp || sender == this.btnDirDown)
				lst = this.lstFolders;
			else lst = this.lstFilename;

			if (lst.SelectedItem != null)
			{
				ListBoxItem li = (ListBoxItem)lst.SelectedItem;
				int index = lst.SelectedIndex;

				if (((Button)sender).CommandParameter.ToString() == "Up")
				{
					if (index > 0) index--;
				}
				else if (((Button)sender).CommandParameter.ToString() == "Down")
				{
					if (index < lst.Items.Count - 1) index++;
				}

				lst.Items.Remove(li);
				lst.Items.Insert(index, li);
				lst.SelectedIndex = index;
			}
		}
	}
}
